package com.ax.associator.storeDoctor.controller;

import com.ax.associator.store.common.ajax.AjaxRes;
import com.ax.associator.store.common.utils.Const;
import com.ax.associator.store.common.utils.PageUtils;
import com.ax.associator.storeDoctor.domain.BaseDoctor;
import com.ax.associator.storeDoctor.domain.DoctorUserDto;
import com.ax.associator.storeDoctor.service.BaseDoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/web/baseDoctor")
public class BaseDoctorController {

    @Autowired
    private BaseDoctorService baseDoctorService;

    @RequestMapping("doctorList")
    public List<DoctorUserDto> queryDoctor(@RequestBody Map<String,Object> map){
        List<DoctorUserDto> list=baseDoctorService.queryDoctor(map);
        return list;
    }

    @RequestMapping("doctorDetails")
    public AjaxRes queryDoctorDetails(AjaxRes ajaxRes,@RequestBody Map<String,Object> map){
        try{
            List<DoctorUserDto> list=baseDoctorService.queryDoctorDetails(map);
            ajaxRes.setSucceed(list, Const.DATA_SUCCEED);
        }catch (Exception e){
            ajaxRes.setFailMsg(e.getMessage());
        }
        return ajaxRes;
    }

}
